<?php
/*
 * 公共Action
 */
class CommonAction extends Action {

    protected static $ADD_SEC = 'add';
    protected static $UPDATE_SEC = 'update';
    protected static $SUCCESS = 'success';
    protected static $ERROR = 'error';

    protected $limit;   // 分页limit

    public function _initialize()
    {
        if(!session('admin'))
            $this->redirect('Public/login');
    }

    public function page($count, $pageSize=10)
    {
        import('ORG.Util.Page');
        $page = new Page($count, $pageSize);
        $page->setConfig('theme',
                        "%upPage% %downPage% %first% %prePage% %linkPage% %nextPage% %end%");
        $this->limit = $page->firstRow . ',' . $page->listRows;
        $this->assign('page', $page->show());
    }
}